#!/bin/bash
# $1 待读取的文件
# $2 脚本执行次数
#
# sh analysis ./logs/__construct_no_magic_php5.log 10000
sum=0
max=0
min=0
i=0
while read line
do
    if [ "$i" -eq 0 ]; then
        min=$line
    fi
    i=$(($i+1))
    sum=$(($sum+$line))
    if [ "$max" -lt "$line" ]; then
        max=$line
    fi
    if [ "$min" -gt "$line" ]; then
        min=$line
    fi
done < "$1"
echo avg: $(($sum/$2))μm
echo max: $maxμm
echo min: $minμm
